home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / GraKa / Picasso96Develop / Examples / RequestModeID.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  1.5 KB  |  53 lines

  1. /***********************************************************************
  2. * This is example shows how to use p96RequestModeIDTagList()
  3. *
  4. * tabt (Sat Dec 28 03:44:35 1996)
  5. ***********************************************************************/
  6.  
  7. #include <proto/exec.h>
  8. #include <proto/dos.h>
  9. #include    <proto/graphics.h>
  10. #include <proto/picasso96.h>
  11.  
  12. #include <stdio.h>
  13.  
  14. char template[]="Width=W/N,Height=H/N,Depth=D/N";
  15.  
  16. LONG array[]={    0, 0, 0, FALSE    };
  17.  
  18. struct Library *P96Base;
  19.  
  20. void main(int argc,char **argv)
  21. {
  22.     if(P96Base=OpenLibrary("Picasso96API.library",2)){
  23.         struct RDArgs *rda;
  24.  
  25.         ULONG    DisplayID;
  26.         LONG width=640, height=480, depth=15;
  27.         
  28.         if(rda=ReadArgs(template,array,NULL)){
  29.             if(array[0])    width =*((LONG *)array[0]);
  30.             if(array[1])    height=*((LONG *)array[1]);
  31.             if(array[2])    depth =*((LONG *)array[2]);
  32.             FreeArgs(rda);
  33.         }
  34.     
  35.         if(DisplayID=p96RequestModeIDTags(
  36.                                         P96MA_MinWidth, width,
  37.                                         P96MA_MinHeight, height,
  38.                                         P96MA_MinDepth, depth,
  39.                                         P96MA_WindowTitle, "RequestModeID Test",
  40.                                         P96MA_FormatsAllowed, (RGBFF_CLUT|RGBFF_R5G6B5|RGBFF_R8G8B8|RGBFF_A8R8G8B8),
  41.                                         TAG_DONE)){
  42.             printf("DisplayID: %lx\n", DisplayID);
  43.             if(DisplayID != INVALID_ID){
  44.                 struct DimensionInfo dim;
  45.                 if(GetDisplayInfoData(NULL,(UBYTE *)&dim,sizeof(dim),DTAG_DIMS,DisplayID)){
  46.                     printf("Dimensions: %ldx%ldx%ld\n",(ULONG)(dim.Nominal.MaxX-dim.Nominal.MinX+1),(ULONG)(dim.Nominal.MaxY-dim.Nominal.MinY+1),(ULONG)dim.MaxDepth);
  47.                 }
  48.             }
  49.         }
  50.         CloseLibrary(P96Base);
  51.     }
  52. }
  53.